<template>
	<view>
		<template v-if="name">
			<view class="bgw item font-bold font-32">【{{name}}】</view>
			<view class="blank20"></view>
		</template>
		<template v-for="v in list">
			<view class="bgw">
				<view class="item">
					<view class="flex">
						<view class="flex-1 flex">
							<view class="font-bold font-32">
								{{v.date}}
							</view>
						</view>
						<!-- <view class="">
							<u-button type="warning" text="修改"
								@click="nav('/pagesA/workflowEdit/workflowEdit')"></u-button>
						</view> -->
						<view class="ml15">
							<u-button type="success" text="查看"
								@click="nav('/pagesA/workflowEdit/workflowEdit?isReadonly=1&id='+v.id+'&date='+v.date+'&name='+v.sop_review_id[1])"></u-button>
						</view>
					</view>
				</view>
			</view>
			<view class="blank20"></view>
		</template>


		<nodata v-if="loadingStatus == 'end' && list.length == 0"></nodata>
		<view class="blank30"></view>

	</view>
</template>

<script>
	import {
		get_one_sop_review_record
	} from '@/common/api.js';
	import nodata from '@/components/nodata.vue';
	export default {
		data() {
			return {
				id: null,
				role: null,
				userInfo: null,
				list: [],
				loadingStatus: '',
				name:''
			}
		},
		components: {
			nodata
		},
		methods: {
			getData() {
				uni.showLoading({
					title: '加载中'
				});
				this.loadingStatus = 'loading';
				get_one_sop_review_record({
					sop_review_id: this.id
				}).then((res) => {
					let {
						one_sop_review_record
					} = res.result;
					this.list = one_sop_review_record;
				}).catch(() => {
					uni.hideLoading();
				}).finally(() => {
					this.loadingStatus = 'end';
					uni.hideLoading();
					uni.stopPullDownRefresh();
				})
				// this.list = [
				// 	{name:'2024/5/9'},
				// 	{name:'2024/5/9'},
				// 	{name:'2024/5/9'},
				// 	{name:'2024/5/9'},
				// 	{name:'2024/5/9'},
				// ];
			}
		},
		onShow() {

		},
		onLoad(d) {
			if (!d.id) {
				d.id = '81';
			}
			if (d.id) {
				this.id = Number(d.id);
			}
			this.name = d.name;
			try {
				this.role = this.$store.getters.get_role;
				this.userInfo = this.$store.getters.get_userInfo;
				this.getData();
			} catch (e) {
				uni.reLaunch({
					url: '/pages/login/login'
				});
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.item {
		padding: 20upx 30upx;
	}
</style>